#include<bits/stdc++.h>
using namespace std;

int vis[2000005]; 
int a[2000005]; 
int b[2000005]; 

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n, m;
	cin>>n>>m;
	for(int i = 1;i <= m;i++)
	{
		cin>>a[i]>>b[i];
		int cnt = 0;
		for(int j = a[i];j <= b[i];j++)
		{
			if(!vis[j])
			{
				cnt++;
				vis[j] = 1;
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

